package ar.edu.itba.it.raytracer.scene

import ar.edu.itba.it.raytracer.engine.{ Vector, Ray }
import scala.Math.abs
import Geom.eps

case class Point(position: Vector) extends Geom {
  def normal(poi: Vector, ray: Ray) = (ray.origin - poi).normalized
  def intersect(ray: Ray) = {
    val direction = (position - ray.origin).normalized
    val diff = (ray.direction - direction)
    if (abs(diff.x) < eps && abs(diff.y) < eps && abs(diff.z) < eps) Some(position) else None
  }
}